from celery_tasks.main import app
from meixixi.libs.yuntongxun.sms import CCP

@app.task(bind=True,name='send_msg_code')
def send_msg_code(self, mobile, sms_code):
    try:
        ccp = CCP()
        result = ccp.send_template_sms(
            mobile, [sms_code, 5], 1)
    except Exception as e:
        result = -1

    if result == -1:
        self.retry(exc=Exception('短信发送失败'), countdown=5, max_retries=3)
